<%-- 
    Document   : index
    Created on : Jun 10, 2012, 12:14:06 PM
    Author     : zw251y
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*, java.sql.*, javax.sql.*, org.brickred.socialauth.*"%>

       <%
         // SocialAuthManager manager2 = (SocialAuthManager)session.getAttribute("authManager");
          //if (manager2.getCurrentAuthProvider().
          
        //Create an instance of SocialAuthConfgi object
        SocialAuthConfig config2 = SocialAuthConfig.getDefault();

        //load configuration. By default load the configuration from oauth_consumer.properties. 
        //You can also pass input stream, properties object or properties file name.
        config2.load();

        //Create an instance of SocialAuthManager and set config
        SocialAuthManager manager = new SocialAuthManager();
        manager.setSocialAuthConfig(config2);

        //URL of YOUR application which will be called after authentication
        String successUrl = "http://www.elookinto.com/wordlist_chinese";

        // get Provider URL to which you should redirect for authentication.
        // id can have values "facebook", "twitter", "yahoo" etc. or the OpenID URL
        String url = manager.getAuthenticationUrl("twitter", successUrl);
        session.setAttribute("authManager", manager);
        System.out.println("current"+manager.getCurrentAuthProvider());
        session.setAttribute("uid", null);
        
        response.sendRedirect(url);
        // Store in session
        
    %>
   
